home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Tools & Apps / Misc. Utilities / Installer / Installer 3.2 / Samples - Installer 3.2 / Script Example.r < prev    next >
Encoding:
Text File  |  1992-01-22  |  25.5 KB  |  651 lines  |  [TEXT/MPS ]

  1. /*
  2.  * This is a sample Installer 3.2 Script.  It demonstrates the use of Easy Install to make
  3.  * decisions about what to install based on the machine type, memory size, etc.
  4.  * I have included one of most script resource types
  5.  * NOTE:  this sample is receiving only limited upgrades - the desk accessory is installed 
  6.  *  only in pre-system 7.0 fashion, see elsewhere for an upto date sample on installing desk
  7.  *  accessories
  8.  */
  9.  
  10.  
  11. /* If you include these two files within the script file, you don't need them on the rez line*/
  12. #include "Types.r"                    /* for the ICON resources */
  13. #include "InstallerTypes.r"            /* for the rest of the script resources */
  14.  
  15. /* You can build the script with the following lines:
  16.     rez -o "PaintWorx™ Script" -t 'bjbc' -c 'bjbc' "Script Example.r"
  17.     setfile -a i "PaintWorx™ Script"
  18.     scriptcheck -p "PaintWorx™ Script"
  19. */
  20.  
  21.  
  22. #define kHaveScriptCheckFillInDate    0x01    /* insert this value in 'infs' to have ScriptCheck fill in date */
  23.  
  24.  
  25. /*
  26.  * Symbolic definitions for script resources make the scripts easier to read and easier to
  27.  * combine with other scripts.  Note:  For the different script resource such as 'inpk',
  28.  * 'infs', 'inra', etc. the #defines obviously must be unique within one particular resource
  29.  * but we could have an 'inpk' 1000 and 'inra' 1000.  BUT, for clarity, I define each resource
  30.  * types with different base values, starting from 1000, 2000, etc.
  31.  */
  32.  
  33.  
  34. /* Definitions for the easy install rules */
  35. #define rlCheckMemSize            1000
  36. #define rlCheckAuditTrail        1001
  37. #define rlOutputMemSizeError    1002
  38. #define rlCheckHardDisk            1003
  39. #define rlCheckFDHD                1004
  40. #define rlOtherDisk                1005
  41. #define rlDescrBaseStuff        1006
  42. #define rlDescrAlmostEvery        1007
  43. #define rlDescrEverything        1008
  44.  
  45. /* Definitions for the assertions we will set and use in the rules */
  46. #define asDoTheInstall                2000
  47. #define asInstallEverything            2001
  48. #define asInstallAlmostEverything    2002
  49. #define asInstallBaseStuff            2003
  50.  
  51. /*
  52.  * Definitions for the file spec atoms.  These tell where we expect to find the files
  53.  * on the source disks and where we want them installed on the target disk.
  54.  */
  55. #define fsSourcePaintProgram    3000
  56. #define fsSourceExampleFile        3001
  57. #define fsSourceDocumentFile    3002
  58. #define    fsSourceExtrasRsrcs        3003
  59.  
  60. #define fsTargetPaintProgram    3004
  61. #define fsTargetExampleFile        3005
  62. #define fsTargetDocumentFile    3006
  63.  
  64. #define fsTargetSystem            3007
  65.  
  66. /* These are the names of the source disks */
  67. #define ProgramDisk "Program Disk:"
  68. #define ExtrasDisk    "Extras Disk:"
  69.  
  70. /* This is the target path where we want to install our files.*/
  71. #define TargetPath    ":PaintWorx™ Application:"
  72.  
  73. /* Definitions for the packages.  */
  74. #define pkBaseStuff                4000
  75. #define pkExamples                4001
  76. #define pkExtraDocuments        4002
  77.  
  78. #define pkBaseFilesRsrcs        4003
  79. #define pkExampleFiles            4004
  80. #define pkDocumentFiles            4005
  81.  
  82. /* Definitions for the package comment resources*/
  83. #define cmtBaseStuff            5000
  84. #define cmtExamples                5001
  85. #define cmtExtraDocuments        5002
  86.     
  87. /*
  88.  * April 5, 1990 is the current release date to put in 'icmt' rsrcs. ScriptCheck
  89.  * will convert this value to a LongInt seconds value needed by the Installer.
  90.  */
  91. #define currentReleaseDate        4051990        
  92.  
  93. #define currentVersion            300                    /* Version 3.0 goes in the 'icmt' rsrc*/
  94.  
  95. #define iconPaintWorx            5100
  96.  
  97. /* Definitions for the resource atoms */
  98. #define raNewColorDA            6000
  99. #define raSpecialColorRsrc        6001
  100. #define raOldRsrcToDelete        6002
  101.  
  102. /* Definitions for the file atoms */
  103. #define faPaintProgram            7000
  104. #define faExampleFile            7001
  105. #define faDocumentFile            7002
  106.  
  107. /*
  108.  * Definitions for the audit trail atoms that we check and install.  These audit
  109.  * trail atoms allow us to leave a "trail" in the target system file that can tell
  110.  * us anything we want. In this case, the audit atoms will tell us which versions
  111.  * of our software we have installed previously on this target volume.
  112.  */
  113.  
  114. /*
  115.  * Remember: Apple has reserved all lower case audit selectors.  (These should 
  116.  * correspond to your Creator Type which you have registered with Developer
  117.  * Technical Support
  118.  */
  119.  
  120. #define auditPaintWorx            'PWRX'
  121. #define auditInstalledVer1        1
  122. #define auditInstalledVer2        2
  123. #define auditInstalledVer3        3
  124.  
  125. /* This definition is for the actual 'inat' audit trail atom we'll install */
  126. #define atPaintWorxVer3            8000
  127.  
  128. /************************** Easy Install Rule resources follow **********************************/
  129.  
  130. /*
  131.  * The 'infr' and 'inrl' Easy Install script resources allow a very natural, programatic
  132.  * structure in writing Easy Install logic.  See the "Installer 3.1 Scripting Guide"
  133.  * for more details on this topic.
  134.  */
  135.  
  136.  
  137. /*
  138.  * I will present the pseudo-code for the framework logic and then present the actual 'infr'
  139.  * resource.  This pseudo-code is just to help explain the framework
  140.  */
  141.  
  142. /*
  143.  * The pickFirst rule groups in the framework correspond to IF-THEN-ELSE type constructs,
  144.  * where a maximum of 1 action can be taken for the group:
  145.  *    IF expression THEN
  146.  *        action
  147.  *    ELSE IF expression THEN
  148.  *        action
  149.  *    ELSE …
  150.  */
  151.     
  152. /*
  153.  * The pickAll rule groups in the framework correspond to IF-THEN type constructs, where
  154.  * up to all of the actions can be taken for the group:
  155.  *    IF expression THEN
  156.  *        action
  157.  *    IF expression THEN
  158.  *        action
  159.  *    IF …
  160.  */
  161.  
  162. #if false  /* Following lines are not Rez'ed */
  163. IF (Memory >= 2MB) THEN            /* say our product only runs on 2MB systems */
  164.     DoTheInstall 
  165. ELSE IF (Audit trail says we installed Version 1, 2, or 3 of our software before) THEN
  166.     DoTheInstall                /* Note: even if the system we're running on only has 1MB of memory */
  167.                                 /* we will still update the software because it was installed on the */
  168.                                 /* disk previously.  This allows an administrator to update a volume */
  169.                                 /* using a machine that doesn't have the 2MB requirement. */
  170. ELSE
  171.     Output Memory Too Small Error
  172.     
  173.  
  174. /* We make our decisions about what packages to install based on the size of the target volume. */
  175. IF DoTheInstall & (Target Volume >= HD) THEN
  176.     InstallEverything
  177. ELSE IF DoTheInstall & (Target Volume >= FDHD) THEN
  178.     InstallAlmostEverything
  179. ELSE IF DoTheInstall & (Target Volume = Floppy) THEN
  180.     InstallBaseStuff
  181.  
  182.  
  183. IF DoTheInstall & (Installing BaseStuff, AlmostEverything, or Everything) THEN
  184.     Add User Description for the BaseStuff part
  185. IF DoTheInstall & (Installing AlmostEverything or Everything) THEN
  186.     Add User Description for the AlmostEverything part
  187. IF DoTheInstall & (Installing Everything) THEN
  188.     Add User Description for the Everything part
  189.     
  190.     
  191. #endif /* we Rez the following lines */
  192.  
  193. resource 'infr' (1) {    /* The framework groups the rules into a logical order of execution */
  194.     format0  {{
  195.         pickFirst,    {rlCheckMemSize, rlCheckAuditTrail, rlOutputMemSizeError},    /* Select one of these three rules */
  196.         pickFirst,    {rlCheckHardDisk, rlCheckFDHD, rlOtherDisk},                /* Select one of these three rules */
  197.         pickAll,     {rlDescrBaseStuff, rlDescrAlmostEvery, rlDescrEverything}     /* Select zero to three of these rules */
  198.     }};
  199. };
  200.  
  201.  
  202. resource 'inrl' (rlCheckMemSize) {
  203.     format0 {{
  204.         checkMinMemory {2},                    /* If the system has at least 2MB memory, then add this assertion */
  205.         addAssertion {{asDoTheInstall}}        /* An assertion is essentially a boolean variable, adding it makes the variable true */
  206.     }};
  207. };
  208.  
  209. resource 'inrl' (rlCheckAuditTrail) {
  210.     format0 {{
  211.         
  212.         /* checkAnyAuditRec looks in the target file (the System file in this case) and sees if any of the values */
  213.         /* for the audit selector exist.  Our audit selector in this case is auditPaintWorx and we want to see if */
  214.         /* any of the values auditInstalledVer1 … 3 are present.  If so, we add assert that we want to DoTheInstall */
  215.         
  216.         checkAnyAuditRec {fsTargetSystem, auditPaintWorx, 
  217.                             {auditInstalledVer1, auditInstalledVer2, auditInstalledVer3}},
  218.         addAssertion {{asDoTheInstall}}
  219.     }};
  220. };
  221.  
  222. resource 'inrl' (rlOutputMemSizeError) {
  223.     format0 {{
  224.         /* These two lines of error messages will be output on the Easy Install screen if this rule */
  225.         /* is fired.  It is fired only if the two other rules in this pickFirst group do NOT fire. */
  226.         
  227.         reportSysError {"To use PaintWorx™ 3.0 you need:\n\n"},        /* up to 4 lines of error reporting may be */
  228.         reportSysError {"• At least 2 Megabytes of Memory\n"}            /* displayed in the Easy Install screen. */
  229.     }};
  230. };
  231.  
  232.  
  233. resource 'inrl' (rlCheckHardDisk) {
  234.     format0 {{
  235.         checkAllAssertions {{asDoTheInstall}},            /* Make sure we made the decision to Install above */
  236.         checkTgtVolSize {hardDisk, hardDisk},            /* HD is 10MB or greater */
  237.         addAssertion {{asInstallEverything}},            /* Assert the variable that says what we're installing */
  238.         addPackages {{pkBaseFilesRsrcs, pkExampleFiles, pkDocumentFiles}}    /* These 3 packages include everything that */
  239.                                                                             /* we want to install. */
  240.     }};
  241. };
  242.  
  243. resource 'inrl' (rlCheckFDHD) {
  244.     format0 {{
  245.         checkAllAssertions {{asDoTheInstall}},            /* Make sure we made the decision to Install above */
  246.         checkTgtVolSize {hdFloppy, hdFloppy},            /* FDHD is defined as hdFloppy in InstallerTypes.r */
  247.         addAssertion {{asInstallAlmostEverything}},        /* Assert the variable that says what we're installing */
  248.         addPackages {{pkBaseFilesRsrcs, pkExampleFiles}}    /* For a FDHD, we don't install as much as a Hard Disk */
  249.     }};
  250. };
  251.  
  252. resource 'inrl' (rlOtherDisk) {
  253.     format0 {{
  254.         checkAllAssertions {{asDoTheInstall}},            /* Make sure we made the decision to Install above */
  255.         checkTgtVolSize {floppy, floppy},                /* Are we installing onto a floppy?*/
  256.         addAssertion {{asInstallBaseStuff}},            /* Assert the variable that says what we're installing */
  257.         addPackages {{pkBaseFilesRsrcs}}                /* For a floppy, we're only installing the program, no extras*/
  258.     }};
  259. };
  260.  
  261.  
  262. resource 'inrl' (rlDescrBaseStuff) {
  263.     format0 {{
  264.         /* If we're installing anything, we want to present this message in Easy Install screen */
  265.         /* We make this decision by checking the assertions that may have been set previously*/
  266.         
  267.         checkAnyAssertion {{asInstallBaseStuff, asInstallAlmostEverything, asInstallEverything}},
  268.         
  269.         addUserDescription {"Version 3.0 of:\n"},                    /* message to appear in Easy Install screen */
  270.         addUserDescription {"• PaintWorx™ application software\n"}    /* can be up to 4 lines of text.*/
  271.     }};
  272. };
  273.  
  274. resource 'inrl' (rlDescrAlmostEvery) {
  275.     format0 {{
  276.         /* We add this description if we're installing the example stuff.  Again we look at the assertions */
  277.         /* set to decide whether to add the description or not.*/
  278.         checkAnyAssertion {{asInstallAlmostEverything, asInstallEverything}},
  279.         addUserDescription {"• PaintWorx™ example pictures\n"}
  280.     }};
  281. };
  282.  
  283. resource 'inrl' (rlDescrEverything) {
  284.     format0 {{
  285.         checkAllAssertions {{asInstallEverything}},
  286.         addUserDescription {"• PaintWorx™ extra documentation\n"}
  287.     }};
  288. };
  289.  
  290.  
  291.  
  292. /***************************** Package Resources ************************************************/
  293.  
  294. /* These first three packages are ShowsOnCustom packages; that means that they are displayed*/
  295. /* and are selectable in the Custom Install screen.*/
  296.  
  297. resource 'inpk' (pkBaseStuff) {
  298.     format0 {
  299.         showsOnCustom,                 /* Package appears in the Custom Install display */
  300.         removable,                    /* Package can be removed */
  301.         forceRestart,                /* Need to restart the mac if we install this pack */
  302.         cmtBaseStuff,                 /* Package 'icmt' resource ID*/
  303.         0,                            /* Package size (filled in by ScriptCheck) */
  304.         "PaintWorx™ application software", {    /* Package Name */
  305.             'inpk', pkBaseFilesRsrcs;
  306.         }
  307.     }
  308. };
  309.  
  310. resource 'inpk' (pkExamples) {
  311.     format0 {
  312.         showsOnCustom,                 /* Package appears in the Custom Install display */
  313.         removable,                    /* Package can be removed */
  314.         dontForceRestart,            /* No need to restart the mac if we install this pack */
  315.         cmtExamples,                 /* Package 'icmt' resource ID*/
  316.         0,                            /* Package size (filled in by ScriptCheck)*/
  317.         "PaintWorx™ example pictures", {    /* Package Name*/
  318.             'inpk', pkExampleFiles;
  319.         }
  320.     }
  321. };
  322.  
  323. resource 'inpk' (pkExtraDocuments) {
  324.     format0 {
  325.         showsOnCustom,                 /* Package appears in the Custom Install display */
  326.         removable,                    /* Package can be removed */
  327.         dontForceRestart,            /* No need to restart the mac if we install this pack */
  328.         cmtExtraDocuments,             /* Package 'icmt' resource ID*/
  329.         0,                            /* Package size (filled in by ScriptCheck)*/
  330.         "PaintWorx™ extra documentation", {        /* Package Name*/
  331.             'inpk', pkDocumentFiles;
  332.         }
  333.     }
  334. };
  335.  
  336. /* Comment resources for each of those three ShowsOnCustom packages */
  337.  
  338. resource 'icmt' (cmtBaseStuff) {
  339.     currentReleaseDate,
  340.     currentVersion,
  341.     iconPaintWorx,
  342.     "This package contains the PaintWorx™ application software. "
  343. };
  344.  
  345. resource 'icmt' (cmtExamples) {
  346.     currentReleaseDate,
  347.     currentVersion,
  348.     iconPaintWorx,
  349.     "This package contains the PaintWorx™ example files. "
  350.     "These pictures show you the power of the software and "
  351.     "the amazing things YOU can do (if you own a graphic artist). "
  352. };
  353.  
  354. resource 'icmt' (cmtExtraDocuments) {
  355.     currentReleaseDate,
  356.     currentVersion,
  357.     iconPaintWorx,
  358.     "This package contains the PaintWorx™ documentation. "
  359.     "This is great late-night reading when your life is "
  360.     "really getting boring. "
  361. };
  362.  
  363. resource 'ICON' (iconPaintWorx) {
  364.         $"0001 0000 0002 8000 0004 4000 0008 2000"
  365.         $"0010 7000 0020 F800 0041 FC00 0083 FA00"
  366.         $"0102 F100 0205 E080 0409 C040 0802 8020"
  367.         $"1001 0010 2002 0008 4000 3F04 8008 4082"
  368.         $"4010 8041 2031 3022 1039 C814 081E 7F8F"
  369.         $"0402 3007 0201 0007 0100 8007 0080 6007"
  370.         $"0040 1FE7 0020 021F 0010 040F 0008 0800"
  371.         $"0004 1000 0002 2000 0001 4000 0000 80"
  372. };
  373.  
  374.  
  375. /* The next three packages were created because they are used a couple of times by the rules */
  376. /* that add packages.  By grouping all of these things into packages this way, instead of making */
  377. /* each package above list all the individual package components, we reduce the    chance of */
  378. /* accidently forgetting to include a resource somewhere. */
  379.  
  380. resource 'inpk' (pkBaseFilesRsrcs) {
  381.     format0 {
  382.         notShowsOnCustom,             /* Package does not appear in the Custom Install display */
  383.         removable,                    /* Package can be removed */
  384.         forceRestart,                /* installing a DA and resource into system file so must reboot */
  385.         0,                             /* do not need an 'icmt' for a package that does not show on custom */
  386.         0,                            /* Package size (filled in by ScriptCheck) */
  387.         "", {                        /* do not need an package name for package that does not show on custom */
  388.             'infa', faPaintProgram;
  389.             'inra', raNewColorDA;
  390.             'inra', raSpecialColorRsrc;
  391.              'inra', raOldRsrcToDelete;
  392.             'inat', atPaintWorxVer3;    /* We want to install the audit trail atom when the program is installed */
  393.         }
  394.     }
  395. };
  396.  
  397. resource 'inpk' (pkExampleFiles) {
  398.     format0 {
  399.         notShowsOnCustom,             /* Package does not appear in the Custom Install display */
  400.         removable,                    /* Package can be removed */
  401.         dontForceRestart,            /* restart not necessary */
  402.         0,                             /* do not need an 'icmt' for a package that does not show on custom */
  403.         0,                            /* Package size (filled in by ScriptCheck)*/
  404.         "", {                        /* do not need an package name for package that does not show on custom*/
  405.             'infa', faExampleFile;
  406.         }
  407.     }
  408. };
  409.  
  410. resource 'inpk' (pkDocumentFiles) {
  411.     format0 {
  412.         notShowsOnCustom,             /* Package does not appear in the Custom Install display */
  413.         removable,                    /* Package can be removed */
  414.         dontForceRestart,            /* restart not required */
  415.         0,                             /* do not need an 'icmt' for a package that does not show on custom */
  416.         0,                            /* Package size (filled in by ScriptCheck) */
  417.         "", {                        /* do not need an package name for package that does not show on custom*/
  418.             'infa', faDocumentFile;
  419.         }
  420.     }
  421. };
  422.  
  423.  
  424. /********************************************* File Specs ***************************************************/
  425.  
  426. /* These resource tell where we expect files on the source disks and where to install them on the target */
  427.  
  428. /* Source File Specs */
  429. resource 'infs' (fsSourcePaintProgram) {
  430.     'APPL',                                        /* File Type */
  431.     'PWRX',                                        /* File Creator */
  432.     kHaveScriptCheckFillInDate,                    /* ScriptCheck tool will fill in the creation date */
  433.     noSearchForFile,                            /* Do not search the source disk for the file */
  434.     TypeCrMustMatch,                            /* The file type and creator on source disk must match */
  435.     ProgramDisk"PaintWorx™"                        /* Path where to find the file */
  436. };
  437.  
  438. resource 'infs' (fsSourceExampleFile) {
  439.     'pdoc',                                        /* File Type */
  440.     'PWRX',                                        /* File Creator */
  441.     kHaveScriptCheckFillInDate,                    /* ScriptCheck tool will fill in the creation date */
  442.     noSearchForFile,                            /* Do not search the source disk for the file */
  443.     TypeCrMustMatch,                            /* The file type and creator on source disk must match */
  444.     ExtrasDisk"Examples:Example Picture"        /* Path where to find the file */
  445. };
  446.  
  447. resource 'infs' (fsSourceDocumentFile) {
  448.     'ttro',                                        /* File Type (teachtext doc) */
  449.     'ttxt',                                        /* File Creator */
  450.     kHaveScriptCheckFillInDate,                    /* ScriptCheck tool will fill in the creation date */
  451.     noSearchForFile,                            /* Do not search the source disk for the file */
  452.     TypeCrMustMatch,                            /* The file type and creator on source disk must match */
  453.     ExtrasDisk"Documents:Info File"                /* Path where to find the file */
  454. };
  455.  
  456. resource 'infs' (fsSourceExtrasRsrcs) {
  457.     'ZSYS',                                        /* File Type */
  458.     'MACS',                                        /* File Creator */
  459.     kHaveScriptCheckFillInDate,                    /* ScriptCheck tool will fill in the creation date */
  460.     noSearchForFile,                            /* Do not search the source disk for the file */
  461.     TypeCrMustMatch,                            /* The file type and creator on source disk must match */
  462.     ProgramDisk"System Folder:System"            /* Path where to find the file */
  463. };
  464.  
  465.  
  466. /* Target File Specs */
  467.  
  468. resource 'infs' (fsTargetPaintProgram) {
  469.     'APPL',                                        /* File Type */
  470.     'PWRX',                                        /* File Creator */
  471.     0,                                            /* not needed for target file specs */
  472.     noSearchForFile,                            /* Do not search the target disk for the file */
  473.     TypeCrMustMatch,                            /* not needed for target file specs */
  474.     TargetPath"PaintWorx™"                        /* Path to install the file into */
  475. };
  476.  
  477. resource 'infs' (fsTargetExampleFile) {
  478.     'pdoc',                                        /* File Type */
  479.     'PWRX',                                        /* File Creator */
  480.     0,                                            /* not needed for target file specs */
  481.     noSearchForFile,                            /* Do not search the target disk for the file */
  482.     TypeCrMustMatch,                            /* not needed for target file specs */
  483.     TargetPath"Examples:Example Picture"        /* Path to install the file into */
  484. };
  485.  
  486. resource 'infs' (fsTargetDocumentFile) {
  487.     'ttro',                                        /* File Type */
  488.     'ttxt',                                        /* File Creator */
  489.     0,                                            /* not needed for target file specs */
  490.     noSearchForFile,                            /* Do not search the target disk for the file */
  491.     TypeCrMustMatch,                            /* not needed for target file specs */
  492.     TargetPath"Documents:Info File"                /* Path to install the file into */
  493. };
  494.  
  495. resource 'infs' (fsTargetSystem) {
  496.     'ZSYS',                                        /* File Type */
  497.     'MACS',                                        /* File Creator */
  498.     0,                                            /* not needed for target file specs */
  499.     noSearchForFile,                            /* Do not search the target disk for the file */
  500.     TypeCrNeedNotMatch,                            /* not needed for target file specs */
  501.     "Blessed:System"                            /* Path to install the file into */
  502. };
  503.  
  504.  
  505.  
  506. /******************************************** File Atoms ************************************************/
  507.  
  508. /* The file atoms define the details of installing files - which forks, update only, etc. */
  509.  
  510. resource 'infa' (faPaintProgram) {
  511.     format0 {
  512.         deleteWhenRemoving,                /* Delete the file if remove is clicked */
  513.         dontDeleteWhenInstalling,         /* no need to delete the target before replacing it */
  514.         copy,                             /* Copy the file to the destination */
  515.         updateEvenIfNewer,                 /* Install this version, if newer one exists, still install */
  516.         updateExisting,                 /* Always replace an existing copy */
  517.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  518.         rsrcFork, dataFork,                /* Copy both forks of the file */
  519.         fsTargetPaintProgram,            /* TARGET file spec for this file */
  520.         fsSourcePaintProgram,             /* SOURCE file spec for this file */
  521.         0,                                /* atom size (filled in by ScriptCheck) */
  522.         ""                                /* Atom Description (for a file Installer will use file name */
  523.     };                                    /*                   which is what we want in this case) */
  524. };
  525.  
  526. resource 'infa' (faExampleFile) {
  527.     format0 {
  528.         deleteWhenRemoving,                /* Delete the file if remove is clicked */
  529.         dontDeleteWhenInstalling,         /* no need to delete the target before replacing it */
  530.         copy,                             /* Copy the file to the destination */
  531.         updateEvenIfNewer,                 /* Install this version, if newer one exists, still install */
  532.         updateExisting,                 /* Always replace an existing copy */
  533.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  534.         rsrcFork, dataFork,                /* Copy both forks of the file */
  535.         fsTargetExampleFile,            /* TARGET file spec for this file */
  536.         fsSourceExampleFile,             /* SOURCE file spec for this file */
  537.         0,                                /* atom size (filled in by ScriptCheck) */
  538.         ""                                /* Atom Description (for a file, Installer will use file name */
  539.     };                                    /*                   which is what we want in this case) */
  540. };
  541.  
  542. resource 'infa' (faDocumentFile) {
  543.     format0 {
  544.         deleteWhenRemoving,                /* Delete the file if remove is clicked */
  545.         dontDeleteWhenInstalling,         /* no need to delete the target before replacing it */
  546.         copy,                             /* Copy the file to the destination */
  547.         updateEvenIfNewer,                 /* Install this version, if newer one exists, still install */
  548.         updateExisting,                 /* Always replace an existing copy */
  549.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  550.         rsrcFork, dataFork,                /* Copy both forks of the file */
  551.         fsTargetDocumentFile,            /* TARGET file spec for this file */
  552.         fsSourceDocumentFile,             /* SOURCE file spec for this file */
  553.         0,                                /* atom size (filled in by ScriptCheck) */
  554.         ""                                /* Atom Description (for a file Installer will use file name */
  555.     };                                    /*                   which is what we want in this case)*/
  556. };
  557.  
  558.  
  559. /********************************** Resource Atoms **************************************************/
  560.  
  561. /* The resource atoms specify the details of the resource we want to install */
  562. /* we can specify resource we want to delete also (eg: outdate resources)*/
  563.  
  564. resource 'inra' (raNewColorDA) {
  565.     format0 {
  566.         deleteWhenRemoving,                /* Delete rsrc if remove is clicked */
  567.         dontDeleteWhenInstalling,         /* no need to delete the target before replacing it */
  568.         copy,                             /* Copy rsrc to destination */
  569.         tgtRequired,                     /* Target file MUST already exist to do the install */
  570.         updateExisting,                 /* Always replace the rsrc */
  571.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  572.         ignoreProtection,                /* Do it even if the target rsrc is protected */
  573.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  574.         byName,                            /* Use NAME to find the rsrc */
  575.         nameMustMatch,                    /* this flag is ignored if finding byName */
  576.         fsTargetSystem,                    /* Target file spec to install rsrc into */
  577.         fsSourceExtrasRsrcs,            /* Source file spec where to get rsrc */
  578.         'DRVR',                            /* Resource type */
  579.         0,                                 /* Resource source id */
  580.         0,                                /* Resource target id */
  581.         0,                                /* atom size (filled in by ScriptCheck) */
  582.         "Desk Accessory: New Color",    /* Atom description */                            
  583.         "\0x00New Color"                /* Resource name */
  584.     };
  585. };
  586.  
  587. resource 'inra' (raSpecialColorRsrc) {
  588.     format0 {
  589.         deleteWhenRemoving,                /* Delete rsrc if remove is clicked */
  590.         dontDeleteWhenInstalling,         /* no need to delete the target before replacing it */
  591.         copy,                             /* Copy rsrc to destination */
  592.         tgtRequired,                     /* Target file MUST already exist on to do the install */
  593.         updateExisting,                 /* Always replace the rsrc */
  594.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  595.         ignoreProtection,                /* Do it even if the target rsrc is protected */
  596.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  597.         byID,                            /* Use ID to find the rsrc */
  598.         nameNeedNotMatch,                /* Resource name need not match our specification */
  599.         fsTargetSystem,                    /* Target file spec to install rsrc into */
  600.         fsSourceExtrasRsrcs,            /* Source file spec where to get rsrc */
  601.         'pcol',                            /* Resource type */
  602.         128,                            /* Resource source id */
  603.         128,                            /* Resource target id */
  604.         0,                                /* atom size (filled in by ScriptCheck) */
  605.         "",                                /* Atom description (we don't want one for this rsrc - */
  606.                                         /* Installer will say "Reading from System") */
  607.         ""                                /* Resource name */
  608.     };
  609. };
  610.  
  611. /* This next resource atom deletes an obsolete resource (if it exists in the target file) */
  612.  
  613. resource 'inra' (raOldRsrcToDelete) {
  614.     format0 {
  615.         deleteWhenRemoving,                /* Delete rsrc if remove is clicked */
  616.         deleteWhenInstalling,             /* Delete target as part of installation - not copying */
  617.         noCopy,                         /* Do NOT copy rsrc to destination (we're deleting it) */
  618.         tgtRequired,                     /* Target file MUST already exist on to do the install */
  619.         updateExisting,                 /* Always replace the rsrc */
  620.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  621.         ignoreProtection,                /* Do it even if the target rsrc is protected */
  622.         srcNeedNotExist,                /* Rsrc does not need to exist on source disk */
  623.         byID,                            /* Use NAME to find the rsrc */
  624.         nameNeedNotMatch,                /* Resource name need not match our specification */
  625.         fsTargetSystem,                    /* Target file spec to install rsrc into */
  626.         0,                                /* Do not need a source file spec for a delete atom */
  627.         'pbit',                            /* Resource type */
  628.         0,                                /* Resource source id */
  629.         128,                            /* Resource target id */
  630.         0,                                /* atom size (filled in by ScriptCheck) */
  631.         "",                                /* Atom description */                            
  632.         ""                                /* Resource name */
  633.     };
  634. };
  635.  
  636.  
  637. /********************************************* Audit Trail Atoms ********************************/
  638.  
  639. /* This audit trail atoms are installed into the target system file and allow us to be smart */
  640. /* when we go to update our software.  We can check the audit in the Easy Install screen and */
  641. /* know what to update in the future.*/
  642.  
  643. resource 'inat' (atPaintWorxVer3) { 
  644.     format0 {
  645.         fsTargetSystem,                    /* Target file where to install the audit atom*/
  646.         auditPaintWorx,                 /* Audit atom selector.*/
  647.         auditInstalledVer3                /* Value to place in the audit trail for this selector */
  648.     };
  649. };
  650.  
  651.